# -*- coding=utf-8 -*-
import tornado.web


class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.render(
            "index.html",
            page_title="BookOnline | Home",
            header_text="嗬，你好！",
        )


class RecommendedHandler(tornado.web.RequestHandler):
    def get(self):
        self.render(
            "recommended.html",
            page_title="BookOnline | Recommended Reading",
            header_text="推荐阅读",
            books=[
                {
                    "title": "Programming Collective Intelligence",
                    "subtitle": "Building Smart Web 2.0 Applications",
                    "image": "/static/images/collective_intelligence",
                    "author": "Toby Segaran",
                    "date_added": 1310248056,
                    "date_released": "August 2007",
                    "isbn": "978-0-596-52932-1",
                    "description": "<p>This fascinating book demonstrates how you "
                                   "can build web applications to mine the enormous amount of data created by people "
                                   "on the Internet. With the sophisticated algorithms in this book, you can write "
                                   "smart programs to access interesting datasets from other web sites, collect data "
                                   "from users of your own applications, and analyze and understand the data once "
                                   "you've found it.</p>"
                },
            ]
        )